from rest_framework import serializers
from rest_framework.viewsets import ModelViewSet
from apps.drf_test_0Django原始restful.models import BookinfoModels


# 1、定义序列化器（转换、校验）
class BookInfoModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = BookinfoModels
        fields = "__all__"


# 2、试图集（增删改查的封装）
class BookInfoModelViewSet(ModelViewSet):
    serializer_class = BookInfoModelSerializer
    queryset = BookinfoModels.objects.all()